<?php
namespace App\Services\Company;

use App\Services\ProjectValidate;
/**
 * @Author: Marte
 * @Date:   2017-05-27 16:25:13
 * @Last Modified by:   ws
 * @Last Modified time: 2018-06-12 10:16
 */
class ValidateCompany extends ProjectValidate
{
    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        
        if (!empty($initData['c_id'])) {
            $this->rules['c_id']  = 'numeric|min:0';
        }
        if (!empty($initData['pic_id'])) {
            $this->rules['pic_id']  = 'numeric';
        }

    }
    
    public $rules = [
        'company_name'  => 'required|string|max:20|min:2',
        'address'       => 'required|string|min:3',
        'code'          => 'required|string',
        'phone_name'    => 'required|string',
        'phone'         => 'required|numeric',
        'company_image' => 'required',
    ];


    public $messages = [
       
    ];

    /**
     * @var array 上面规则中定义的 key 的名字
     */
    public $attributes = [
        'company_name'  => '公司名',
        'address'       => '地址',
        'code'          => '代码',
        'phone_name'    => '联系人姓名',
        'phone'         => '联系电话',
        'company_image' => '公章',
    ];
}